/**
 * 
 */
package com.laozhao.dreamframe.dbmanager;

import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;

import javax.sql.DataSource;

/**
 * @author LaoZhao
 *
 */
public abstract class AbstractDataSource {
	
//	private static HashMap<String, AbstractDataSource> dataSource;

	/**
	 * 定义 XML 元素
	 */
	//node
	private final String data_sourceNodeName = "data_source";
	private final String serverNodeName = "server";
	private final String loginNodeName = "login";
	private final String transactionNodeName = "transaction";
	private final String poolingNodeName = "pooling";
	private final String capacityNodeName = "capacity";
	private final String retryingNodeName = "retrying";
	private final String testingNodeName = "testing";
	private final String shrinkingNodeName = "shrinking";
	private final String encodingNodeName = "encoding";
	
	//key
	private final String sourceNameKey = "sourceName";
	private final String sourceDbTypeNameKey = "sourceDbTypeName";
	private final String serverNameKey = "serverName";
	private final String serverPortKey = "serverPort";
	private final String serverDatabaseNameKey = "serverDatabaseName";
	private final String srcKey = "src";
	private final String urlKey = "url";
	private final String usrKey = "usr";
	private final String pwdKey = "pwd";
	private final String autoCommitKey = "autoCommit";
	private final String poolEnableKey = "poolEnable";
	private final String capMaxKey = "capMax";
	private final String capInitKey = "capInit";
	private final String retryTimesKey = "retryTimes";
	private final String retryIntervalKey = "retryInterval";
	private final String testEnableKey = "testEnable";
	private final String shrinkEnableKey = "shrinkEnable";
	private final String shrinkIntervalKey = "shrinkInterval";
	private final String encodEnableKey = "encodEnable";
	private final String charsetKey = "charset";

	//value
	private String sourceNameValue = "";
	private String sourceDbTypeNameValue = "";
	private String serverNameValue = "";
	private String serverPortValue = "";
	private String serverDatabaseNameValue = "";
	private String srcValue = "";
	private String urlValue = "";
	private String usrValue = "";
	private String pwdValue = "";
	private boolean autoCommitValue = false;
	private boolean poolEnableValue = false;
	private int capMaxValue = 0;
	private int capInitValue = 0;
	private int retryTimesValue = 0 ;
	private int retryIntervalValue = 0 ;
	private boolean testEnableValue = false;
	private boolean shrinkEnableValue = false;
	private int shrinkIntervalValue = 0;
	private boolean encodEnableValue = false;
	private String charsetValue = "";
	
	/**
	 * 
	 */
	public AbstractDataSource() {	}
	
	/**
	 *  抽象方法:
	 *  	通过<data_source.xml>的文件路径 创建DataSource
	 *  @String fileName
	 */
	public AbstractDataSource(String fileName){};
	/**
	 *  抽象方法:
	 *  	通过<data_source.xml>文件 创建DataSource
	 * @param file
	 */
	public AbstractDataSource(File file){};
	/**
	 *  抽象方法:
	 *  	通过<data_source.xml>的文件输入流 来创建DataSource
	 * @param inputStream
	 */
	public AbstractDataSource(FileInputStream inputStream){};
	

	/**
	 * 
	 * node name
	 */
	protected String getData_sourceNodeName() {
		return data_sourceNodeName;
	}
	protected String getServerNodeName() {
		return serverNodeName;
	}
	protected String getLoginNodeName() {
		return loginNodeName;
	}
	protected String getTransactionNodeName() {
		return transactionNodeName;
	}
	protected String getPoolingNodeName() {
		return poolingNodeName;
	}
	protected String getCapacityNodeName() {
		return capacityNodeName;
	}
	protected String getRetryingNodeName() {
		return retryingNodeName;
	}
	protected String getTestingNodeName() {
		return testingNodeName;
	}
	protected String getShrinkingNodeName() {
		return shrinkingNodeName;
	}
	protected String getEncodingNodeName() {
		return encodingNodeName;
	}
	
	/**
	 * 属性keys beans
	 */ 

	protected String getSourceNameKey() {
		return sourceNameKey;
	}
	protected String getSourceDbTypeNameKey() {
		return sourceDbTypeNameKey;
	}
	protected String getServerNameKey() {
		return serverNameKey;
	}
	protected String getserverPortKey() {
		return serverPortKey;
	}
	protected String getserverDatabaseNameKey() {
		return serverDatabaseNameKey;
	}
	protected String getSrcKey() {
		return srcKey;
	}
	protected String getUrlKey() {
		return urlKey;
	}
	protected String getUsrKey() {
		return usrKey;
	}
	protected String getPwdKey() {
		return pwdKey;
	}
	protected String getAutoCommitKey() {
		return autoCommitKey;
	}
	protected String getPoolEnableKey() {
		return poolEnableKey;
	}
	protected String getCapMaxKey() {
		return capMaxKey;
	}
	protected String getCapInitKey() {
		return capInitKey;
	}
	protected String getRetryTimesKey() {
		return retryTimesKey;
	}
	protected String getRetryIntervalKey() {
		return retryIntervalKey;
	}
	protected String getTestEnableKey() {
		return testEnableKey;
	}
	protected String getShrinkEnableKey() {
		return shrinkEnableKey;
	}
	protected String getShrinkIntervalKey() {
		return shrinkIntervalKey;
	}
	protected String getEncodEnableKey() {
		return encodEnableKey;
	}
	protected String getCharsetKey() {
		return charsetKey;
	}
	
	
	
	/**
	 * 属性值beans
	 */

	public String getSourceNameValue() {
		return sourceNameValue;
	}
	public void setSourceNameValue(String sourceNameValue) {
		this.sourceNameValue = sourceNameValue;
	}
	public String getSourceDbTypeNameValue() {
		return sourceDbTypeNameValue;
	}
	public void setSourceDbTypeNameValue(String sourceDbTypeNameValue) {
		this.sourceDbTypeNameValue = sourceDbTypeNameValue;
	}
	public String getServerNameValue() {
		return serverNameValue;
	}
	public void setServerNameValue(String serverNameValue) {
		this.serverNameValue = serverNameValue;
	}
	public String getserverPortValue() {
		return serverPortValue;
	}
	public void setserverPortValue(String serverPortValue) {
		this.serverPortValue = serverPortValue;
	}
	public String getserverDatabaseNameValue() {
		return serverDatabaseNameValue;
	}
	public void setserverDatabaseNameValue(String serverDatabaseNameValue) {
		this.serverDatabaseNameValue = serverDatabaseNameValue;
	}
	public String getSrcValue() {
		return srcValue;
	}
	public void setSrcValue(String srcValue) {
		this.srcValue = srcValue;
	}
	public String getUrlValue() {
		return urlValue;
	}
	public void setUrlValue(String urlValue) {
		this.urlValue = urlValue;
	}
	public String getUsrValue() {
		return usrValue;
	}
	public void setUsrValue(String usrValue) {
		this.usrValue = usrValue;
	}
	public String getPwdValue() {
		return pwdValue;
	}
	public void setPwdValue(String pwdValue) {
		this.pwdValue = pwdValue;
	}
	public boolean isAutoCommitValue() {
		return autoCommitValue;
	}
	public void setAutoCommitValue(boolean autoCommitValue) {
		this.autoCommitValue = autoCommitValue;
	}
	public boolean isPoolEnableValue() {
		return poolEnableValue;
	}
	public void setPoolEnableValue(boolean poolEnableValue) {
		this.poolEnableValue = poolEnableValue;
	}
	public int getCapMaxValue() {
		return capMaxValue;
	}
	public void setCapMaxValue(int capMaxValue) {
		this.capMaxValue = capMaxValue;
	}
	public int getCapInitValue() {
		return capInitValue;
	}
	public void setCapInitValue(int capInitValue) {
		this.capInitValue = capInitValue;
	}
	public int getRetryTimesValue() {
		return retryTimesValue;
	}
	public void setRetryTimesValue(int retryTimesValue) {
		this.retryTimesValue = retryTimesValue;
	}
	public int getRetryIntervalValue() {
		return retryIntervalValue;
	}
	public void setRetryIntervalValue(int retryIntervalValue) {
		this.retryIntervalValue = retryIntervalValue;
	}
	public boolean isTestEnableValue() {
		return testEnableValue;
	}
	public void setTestEnableValue(boolean testEnableValue) {
		this.testEnableValue = testEnableValue;
	}
	public boolean isShrinkEnableValue() {
		return shrinkEnableValue;
	}
	public void setShrinkEnableValue(boolean shrinkEnableValue) {
		this.shrinkEnableValue = shrinkEnableValue;
	}
	public int getShrinkIntervalValue() {
		return shrinkIntervalValue;
	}
	public void setShrinkIntervalValue(int shrinkIntervalValue) {
		this.shrinkIntervalValue = shrinkIntervalValue;
	}
	public boolean isEncodEnableValue() {
		return encodEnableValue;
	}
	public void setEncodEnableValue(boolean encodEnableValue) {
		this.encodEnableValue = encodEnableValue;
	}
	public String getCharsetValue() {
		return charsetValue;
	}
	public void setCharsetValue(String charsetValue) {
		this.charsetValue = charsetValue;
	}

}
